package json;

import javax.validation.constraints.Digits;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.NotEmpty;
import org.hibernate.validator.constraints.Email;

import constraints.IsDate;

public class JSONCustomer {
	private String id;
	
	@NotEmpty
	private String name;

	@NotEmpty
	private String addr;

	@NotEmpty
	//@IsDate(format="yyyyMMdd")
	private String birthday;

	@NotEmpty
	private String hukou;

	@Email
	private String email;

	@Pattern(regexp="(((\\w+)\\.)+(\\w+))?")
	private String url;

	@Digits(integer = 3, fraction = 0)
	@Min(value = 100)
	@Max(value = 230)
	private String height;

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	public void setAddr(String addr) {
		this.addr = addr;
	}

	public String getAddr() {
		return addr;
	}

	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}

	public String getBirthday() {
		return birthday;
	}

	public void setHukou(String hukou) {
		this.hukou = hukou;
	}

	public String getHukou() {
		return hukou;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getEmail() {
		return email;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	public String getUrl() {
		return url;
	}

	public void setHeight(String height) {
		this.height = height;
	}

	public String getHeight() {
		return height;
	}

	public String toString() {
		return "name:"+name+";";
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getId() {
		return id;
	}
	
	public String[] toArray() {
		String[] ret = new String[8];
		ret[0] = this.id;
		ret[1] = this.name;
		ret[2] = this.addr;
		ret[3] = this.birthday;
		ret[4] = this.hukou;
		ret[5] = this.email;
		ret[6] = this.url;
		ret[7] = this.height;
		
		return ret;
	}
	
}
